package com.nbsaas.boot.config.rest.resource;

import com.nbsaas.boot.config.api.apis.UserConfigApi;
import com.nbsaas.boot.config.data.entity.UserConfig;
import com.nbsaas.boot.config.api.domain.request.UserConfigRequest;
import com.nbsaas.boot.config.api.domain.response.UserConfigResponse;
import com.nbsaas.boot.config.api.domain.simple.UserConfigSimple;
import com.nbsaas.boot.config.rest.convert.UserConfigSimpleConvert;
import com.nbsaas.boot.config.rest.convert.UserConfigEntityConvert;
import com.nbsaas.boot.config.rest.convert.UserConfigResponseConvert;
import com.nbsaas.boot.config.data.repository.UserConfigRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   用户配置-业务接口实现
*/
@Transactional
@Service
public class UserConfigResource extends BaseResource<UserConfig,UserConfigResponse, UserConfigSimple, UserConfigRequest>  implements UserConfigApi {

    @Resource
    private UserConfigRepository userConfigRepository;

    @Override
    public JpaRepositoryImplementation<UserConfig, Serializable> getJpaRepository() {
        return userConfigRepository;
    }

    @Override
    public Function<UserConfig, UserConfigSimple> getConvertSimple() {
        return new UserConfigSimpleConvert();
    }

    @Override
    public Function<UserConfigRequest, UserConfig> getConvertForm() {
        return new UserConfigEntityConvert();
    }

    @Override
    public Function<UserConfig, UserConfigResponse> getConvertResponse() {
        return new UserConfigResponseConvert();
    }




}


